home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / AEA / Source / Sources / Event Handlers / AEAHandlerGetData.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1.2 KB  |  51 lines

  1. /*    ====================
  2.  *    AEAHandlerGetData.cc
  3.  *    ====================
  4.  */
  5.  
  6. #include "AEADebugging.h"
  7.  
  8. // Universal Headers
  9. #include <AEObjects.h>
  10. #include <AERegistry.h>
  11.  
  12. // AEA
  13. #include "AEADescObjectSpecifier.hh"
  14. #include "AEADescAppleEvent.hh"
  15. #include "AEAToken.hh"
  16.  
  17. #include "AEAHandlerGetData.hh"
  18.  
  19.  
  20. AEAHandlerGetData::AEAHandlerGetData()
  21. : AEAHandler(kAECoreSuite, kAEGetData)
  22. {
  23.     MakeNoteToTouchParam(keyDirectObject);
  24. }
  25.  
  26. AEAHandlerGetData::~AEAHandlerGetData()
  27. {
  28. }
  29.  
  30. void
  31. AEAHandlerGetData::HandleEventSelf(const AEADescAppleEvent &inAppleEvent, AEADescAppleEvent &outReply)
  32. {
  33.     AEADescObjectSpecifier obj;
  34.     AEDesc param;
  35.     AEADesc dataDesc;
  36.     
  37.     // Get the object specifier indicating which data we should return.
  38.     inAppleEvent.GetParameter(keyDirectObject, typeObjectSpecifier, param);
  39.     obj.Ref() = param;
  40.     // Resolve the object specifier into a token.
  41.     AEAMetatoken token(obj.Resolve());
  42.     
  43.     obj.Dispose();
  44.     // Make a descriptor for the data represented by the token.
  45.     // (This could be a simple type, another object specifier, a list, etc.)
  46.     token.MakeDataDescriptor(dataDesc.Ref());
  47.     
  48.     // Put the data into the reply.
  49.     outReply.PutParameter(keyDirectObject, dataDesc);
  50. }
  51.